package com.service.device;

import com.common.ErrorCodeEnum;
import com.common.emums.DataStatus;
import com.common.exception.BusinessException;
import com.common.utils.StringUtils;
import com.core.springSecurity.common.SecurityUtils;

import com.dao.secondary.device.DeviceObdExFactoryBatchBindInfoMapper;
import com.model.domain.device.GetDeviceObdExFactoryBatchBindInfoDO;
import com.model.pojo.device.DeviceObdExFactoryBatchBindInfo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;



/**
 * @Author: zql
 * @Description: OBD批次绑定设备记录信息服务
 * @Data: 2023-11-29
 */
@Slf4j
@Service
@RequiredArgsConstructor
public class DeviceObdExFactoryBatchBindInfoService {
    private final DeviceObdExFactoryBatchBindInfoMapper deviceObdExFactoryBatchBindInfoMapper;
    public List<DeviceObdExFactoryBatchBindInfo> getPageList(GetDeviceObdExFactoryBatchBindInfoDO getDeviceObdExFactoryBatchBindInfoDO){
        PageHelper.clearPage();
        PageHelper.startPage(getDeviceObdExFactoryBatchBindInfoDO.getPage(),getDeviceObdExFactoryBatchBindInfoDO.getPageSize(),getDeviceObdExFactoryBatchBindInfoDO.getSortRow()+getDeviceObdExFactoryBatchBindInfoDO.getSortOrder());
        return deviceObdExFactoryBatchBindInfoMapper.selectList(getDeviceObdExFactoryBatchBindInfoDO);
    }

    public int save(DeviceObdExFactoryBatchBindInfo info){
        info.setCreateTime(new Date());
        return deviceObdExFactoryBatchBindInfoMapper.insertSelective(info);
    }
    public DeviceObdExFactoryBatchBindInfo getById(Long id){
        return deviceObdExFactoryBatchBindInfoMapper.selectByPrimaryKey(id);
    }
}
